package IO流;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Test1 {
    public static void main(String[] args) {
        FileInputStream file=null;//写在这finally可以捕获file

        try {
            file=new FileInputStream("e:\\a.txt");
            int temp=0;
            StringBuilder sb=new StringBuilder();
            while((temp=file.read())!=-1){
                System.out.println(temp);
                sb.append((char)temp);
            }
            System.out.println(sb);
           // System.out.println(temp.toString());

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(file!=null){
                try {
                    file.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
